-- Guards
-- Created by chengb Jul/26/2016
-- 侍卫格子

local myUnrealId = 22;      -- 侍卫所在的夹层迷宫编号
local GUARDS_PET_ID = 27;     -- 侍卫对应的冈布奥编号

-- 初始化
function initGuards(self)
    self.item:removeAllChildren();

    local iconPath = getHeroIconPath(GUARDS_PET_ID);
    self.icon = ccui.ImageView:create(iconPath);
    self.icon:setTouchEnabled(true);
    self.icon:setPositionY(10);
    self.item:addChild(self.icon);
    self.icon:setScale(1.2);
    self.item:setPositionY(-10);
    
    -- 呼吸
    self.needAnimation = true;
end

-- 侍卫发言
function doGuardsTalk(self)
    local content = "";
    if not BraveVSDragonM.hasEnteredUnreal(myUnrealId) then
        -- 初次进入时弹出对白
        content = getLocStr("guards_dialog1");
    elseif BraveVSDragonM.hasRescuedPrincess() then
        -- 已经救出公主
        content = getLocStr("guards_dialog3");
    else
        -- 还没救出公主
        content = getLocStr("guards_dialog2");
    end

    self:doRoleTalk(content);
end
